package com.itheima.reggie.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration      //配置类
public class MybatisPlusConfig {

    @Bean       //将MybatisPlus拦截器交给ioc容器创建
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        //创建MybatisPlusInterceptor拦截器
        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
        //开启分页拦截
        mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        //返回
        return mybatisPlusInterceptor;
    }

}
